#ifndef VENUS_GRAPHICS_PROGRAM_GLSL_H
#define VENUS_GRAPHICS_PROGRAM_GLSL_H

#include "common/venus.h"
#include "opengl.h"

namespace venus {
class ShaderObject;
class ProgramGLSL {
 public:
  ProgramGLSL();
  ~ProgramGLSL();
  void Load(const char *vertex_shader, const char *fragment_shader);
  void Begin() const;
  void End() const;
  static void Disable();
  void AttachShader(const ShaderObject &shader) const;
  void DetachShader(const ShaderObject &shader) const;
  void Link();	
  GLint GetUniformVar(const char *name) const {
    return glGetUniformLocation(program_id_, name);
  }
  bool is_valid() const { return 0 != program_id_; }
  bool is_linked() const { return is_linked_; }
  GLuint program_id() const { return program_id_; }
 private:
  void PrintLinkLog() const;
  void CheckLinkLog();
 private:
  GLuint program_id_;
  bool is_linked_;
};

} // namespace venus

#endif // VENUS_GRAPHICS_PROGRAM_GLSL_H
